package com.ccnu.JobHub.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ccnu.JobHub.model.database.ViewPost;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ViewPostMapper extends BaseMapper<ViewPost> {
    /**
     * 搜索升学帖
     * @param search 搜索内容
     * @param page 当前页码
     * @param pageSize 页面大小
     * @return 返回一个list
     */
    @Select("SELECT * FROM enrollment_post where title like CONCAT('%',#{search},'%') or content like CONCAT('%',#{search},'%') limit #{page},#{pageSize}")
    List<ViewPost> searchEnrollmentPost(@Param("search") String search, @Param("page") Integer page, @Param("pageSize") Integer pageSize);

    /**
     * 搜索就业帖
     * @param search 搜索内容
     * @param page 当前页码
     * @param pageSize 页面大小
     * @return 返回一个list
     */
   @Select("SELECT * FROM job_post where title like CONCAT('%',#{search},'%') or content like CONCAT('%',#{search},'%') limit #{page},#{pageSize}")
    List<ViewPost> searchJobPost(@Param("search") String search, @Param("page") Integer page, @Param("pageSize") Integer pageSize);

}
